package com.excerise.arr.hotel;

/**
 * 房间对象
 *
 * @author Way on 2021/4/28
 */
@SuppressWarnings({"all"})
public class Room {

    /**
     * 一楼：101，102，103，104，105
     * 二楼：201，202，203，204，205
     * 三楼：301，302，303，304，305
     * ......
     */
    private int no;

    /**
     * 1：单人间
     * 2：标准间
     * 3：豪华间
     */
    private int type;

    /**
     * true：已预订
     * false：空闲
     */
    private boolean status;

    public Room(int no, int type, boolean status) {
        this.no = no;
        this.type = type;
        this.status = status;
    }

    public Room() {
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || !(o instanceof Room)) return false;
        if (this == o) return true;
        Room room = (Room) o;
        return this.no == room.getNo();
    }

    @Override
    public String toString() {
        return "[" + no + "号" + roomTypeToString(type) + "，当前状态：" + (status ? "已预订" : "空闲") + "]";
    }

    public String roomTypeToString(int type) {
        String roomType;
        switch (type) {
            case 1:
                roomType = "单人间";
                break;
            case 2:
                roomType = "标准间";
                break;
            case 3:
                roomType = "豪华间";
                break;
            default:
                roomType = "房间类型加载异常...";
        }
        return roomType;
    }

    // -- set / get

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }
}
